package structural.adapter.custom;

import structural.adapter.custom.spring.ModelAndView;
import structural.adapter.custom.spring.SpringController;
import structural.adapter.custom.struts.StrutsAction;

/**
 * 对象适配器
 */
public class ObjectAdapter implements SpringController {

    StrutsAction strutsAction;

    public ObjectAdapter(StrutsAction strutsAction) {
        this.strutsAction = strutsAction;
    }

    @Override
    public ModelAndView add(Entity entity) {
        strutsAction.setEntity(entity);
        String page = strutsAction.to_add();
        return new ModelAndView(page);
    }

}
